﻿using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Text;

var secretKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Symmetric Security Key"));
var signingCredentials = new SigningCredentials(secretKey, SecurityAlgorithms.HmacSha256);

var securityToken = new JwtSecurityToken(
    signingCredentials: signingCredentials
);

var jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
var token = jwtSecurityTokenHandler.WriteToken(securityToken);

Console.WriteLine(token);
Console.ReadLine();